
<div id="conte-middle">
	<section class="posts">
		<?php if(isset($banners)){ ?>
		<div id="slider" class="nivoSlider">
		<?php
		$bans = $bans_des = $des_ban = '';
		foreach ($banners as $key => $value) {
			$bans_des = '';
			if($value['description'] != ''){
				$bans_des = ' title="#desc'.$key.'"';
				$des_ban .= '<div id="desc'.$key.'" class="nivo-html-caption">'.$value['description'].'</div>';
			}
			
			if($value['link'] != '')
				$bans .= '<a href="'.$value['link'].'">
				<img src="'.$value['image'].'"'.$bans_des.' width="626" height="265" /></a>';
			else
				$bans .= '<img src="'.$value['image'].'"'.$bans_des.' width="626" height="265" />';
		} 
			echo $bans; ?>
		</div>
		<?php echo $des_ban; ?>
	<?php } ?>
	
		<header class="p-head">
			<h1><?php echo (isset($seo['title2'])? $seo['title2']: ''); //(isset($actor)? $actor['name']: lang('v_publications')); ?></h1>
		</header>
		
<?php
	if(isset($publication)){
		//Paginacion
		$this->pagination->initialize(array(
			'base_url' 			=> Sys::$url_base.$this->uri->uri_string().'/',
			'total_rows'		=> $publication['total_rows'],
			'per_page'			=> $publication['items_per_page'],
			'cur_page'			=> $publication['result_page']*$publication['items_per_page'],
			'page_query_string'	=> TRUE,
			'num_links'			=> 1,
			'anchor_class'		=> 'pags corner-all'
		));
		$pagination = $this->pagination->create_links();
		echo '<div class="pagination w100">'.$pagination.'</div>';
		
		foreach ($publication['publications'] as $key => $value) {
			$title_episode	= '';
			$url_article_e 	= '';
			if($value['type'] == 'Serie'){
				$title 			= $value['title'].' [Online] ['.lang('v_download').']';
				$url_article 	= base_url($lang_url.'series~'.$value['id_season'].'~'.$value['clean_title'].'~temporada~'.$value['no_season']);
				$title_episode	= $value['title_episode'];
				$url_article_e 	= base_url($lang_url.'series~'.$value['id'].'~'.$value['clean_title'].'~'.$value['clean_title_episode']);
			}else{
				$title 			= $value['title'].' [Online] ['.lang('v_download').']';
				$url_article 	= base_url($lang_url.'films~'.$value['id'].'~'.$value['clean_title']);
			}
			
?>
		<article>
			<header>
				<h1><a href="<?php echo $url_article; ?>"><?php echo $title; ?></a></h1>
				<p><?php echo lang('v_posted_by'); ?> <span><?php echo $value['posted_by']; ?></span> <?php echo lang('v_the'); ?> 
					<time datetime="<?php echo $value['date']; ?>"><?php echo $value['date']; ?></time>. <?php echo lang('v_updated'); ?> 
					<time datetime="<?php echo $value['last_update']; ?>"><?php echo $value['last_update']; ?></time></p>
			</header>
			<div class="post-conte">
				<div class="post-poster float-l">
					<img src="<?php echo base_url('application/images/pelimaniaco_poster.jpg'); ?>" data-original="<?php echo $value['posters']['big']; ?>" class="img-lazyload" width="277" height="312" />
					<span><?php echo $value['type']; ?></span>
				</div>
				
				<div class="post-info float-r">
					<nav>
						<ul>
						<?php
							$url_cat = '';
							foreach ($value['categories'] as $keyc => $categorie) {
								if(isset($actor)){
									$url_cat = base_url($lang_url.$categorie['id']).'/';
								}elseif(isset($list)){
									$url_cat = explode('~', Sys::$url_base.$this->uri->uri_string());
									$url_cat = $url_cat[0].'~'.$categorie['id'].'/';
								}else{
									
									$url_cat = preg_replace(
										array('/([0-9]+)\//', '/([0-9]+)/', '/([a-z]+)\~([0-9]+)/'), 
										array('', '', '$1'), 
										$this->uri->uri_string().($this->uri->total_segments()==1? '/': '')
									);
									$url_cat = Sys::$url_base.$url_cat.$categorie['id'].'/';
								}
						 		echo '<li><a href="'.$url_cat.'"'.($keyc==0?' class="first"': '').'>'.$categorie['name'].'</a></li>';
							} 
						?>
						</ul>
						<div class="clear"></div>
					</nav>
					
					<div class="info">
						<table class="tbl-info">
						<?php 
							if($title_episode != ''){
						?>
							<tr>
								<td class="hed" colspan="2"><a href="<?php echo $url_article_e ?>"><?php echo $title_episode; ?></a></td>
							</tr>
						<?php
							} 
						?>
							<tr>
								<td class="hed"><?php echo lang('v_release_date'); ?></td>
								<td><?php echo $value['year']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_language'); ?></td>
								<td><?php echo $value['language']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_subtitle'); ?></td>
								<td><?php echo $value['subtitle']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_format'); ?></td>
								<td><?php echo $value['format']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_quality'); ?></td>
								<td><?php echo $value['quality']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_duration'); ?></td>
								<td><?php echo $value['duration']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_size'); ?></td>
								<td><?php echo $value['size']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_servers'); ?></td>
								<td><?php //Nombres de los servidores
									$ser = '';
									foreach ($value['sources'] as $keys => $source) {
										$ser .= ', <a href="'.$source['short'].'" class="serverss '.$source['name'].'" title="'.lang('v_download').
											' '.$source['name'].'" rel="nofollow" target="_blank">'.$source['name'].'</a>';
									}
									echo substr($ser, 1);
								?></td>
							</tr>
						</table>
						<p class="sinop"><?php //Sinopsis
						echo substr(
							($lang != 'spa'? $value['synopsis_'.$lang]: $value['synopsis_spa'])
						, 0, 250).'...'; ?></p>
						
						<a href="<?php echo $url_article; ?>" title="<?php echo $title; ?>" class="btn-green corner-all float-r"><?php echo lang('v_enter'); ?></a>
					</div>
				</div>
				<div class="clear"></div>
			</div>
		</article>
<?php
		}
		
		echo '<div class="pagination">'.$pagination.'</div>';
	}
?>
		
	</section>

